<?php
$content = new Models_Articles();
$articles = $content->getAllArticles();
require_once 'adminmenu.php';
?>
<form class="form-horizontal" action="/<?php echo $content->path; ?>articles/addingsub" method="POST">
      <fieldset>
        <legend>Add new article:</legend>
        <div class="control-group">
          <label class="control-label">Name:</label>
          <div class="controls">
            <input type="text" class="span2" name="0" value="<?php echo ''; ?>">
          </div>
        </div>
        <div class="control-group">
            <textarea id="content" class="span2" rows="3" name="1"></textarea>
        </div>
        <div class="control-group">
          <label class="control-label">Menu:</label>
          <div class="controls">
            <select size="5" name="2" required>
                <option value="0" >-</option>
                <?php
                    foreach ($articles as $menu)
                    {
                        echo "<option value=" . $menu['id']
                                              . ">"
                                              . $menu['title'] 
                                              . "</option>";
                    }
                ?>
            </select>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label">Visible:</label>
          <div class="controls">
            <label class="radio"><input type="radio" name="3" value="1" checked>Yes</label>
            <label class="radio"><input type="radio" name="3" value="0">No</label>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label">Comments:</label>
          <div class="controls">
            <label class="radio"><input type="radio" name="4" value="1" checked>Yes</label>
            <label class="radio"><input type="radio" name="4" value="0">No</label>
          </div>
        </div>
        <div class="form-actions">
          <button class="btn btn-primary" type="submit">Add</button>
          <button class="btn" type="reset">Clear</button>
        </div>
      </fieldset>
    </form>
<script type="text/javascript">
    //<![CDATA[

            CKEDITOR.replace( 'content',
                    {
                            fullPage : false,
                            extraPlugins : 'docprops'
                    });

    //]]>
</script>